package com.myteam.fugaocrm.sqldb.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import com.myteam.fugaocrm.modle.FgProjectLog;

/**
 * 售前日志
 * @author BZX
 *
 */
public interface FgProjectLogMapper {

	@Select("SELECT * from fg_project_log  l WHERE is_delete = 0 and project_id = #{projectId}")
	public List<FgProjectLog> selectByProjectId(Integer projectId);
	
	public void updateOne(FgProjectLog log);
	
	@Insert("INSERT into fg_project_log( project_id, todo_something, todo_date, is_done, done_date, created_user, modified_user, created_date, modified_date, is_delete) "
			+ "VALUES(#{projectId},#{todoSomething},#{todoDate},#{isDone},#{doneDate},#{createdUser},#{modifiedUser},#{createdDate},#{modifiedDate},#{isDelete});")
	public void insertProjectLog(FgProjectLog log);
	
	/** 定时提醒查询 (未删除 & 未处理 & 当天) */
	@Select("SELECT log.*,project.project_name FROM fg_project_log log LEFT JOIN fg_project project ON project.project_id = log.project_id WHERE log.is_delete = 0 AND log.is_done = 'N' AND to_days(log.todo_date) = to_days(now())")
	public List<FgProjectLog> selectToTask();
}
